﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections;
using Delonix_Regia_Hotel_Management_System.Class;

namespace Delonix_Regia_Hotel_Management_System
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            string staffId = tbxUsername.Text;
            string staffPassword = tbxPassword.Text;
            string administrator = "Administrator";
            string receptionist = "Receptionist";
            Staff s = new Staff();

            if (DBManager.Login(staffId, staffPassword) == true)
            {
                s = DBManager.GetStaffDetailsByID(staffId);

                if (s.position.Equals(administrator))
                {
                    Main__Management_and_Administrator_ main = new Main__Management_and_Administrator_();
                    this.Hide();
                    main.Show();
                    LogInClass.position = "Administrator";

                }
                else if (s.position.Equals(receptionist))
                {
                    Main__Receptionist_ R = new Main__Receptionist_();
                    this.Hide();
                    R.Show();
                    LogInClass.position = "Receptionist";
                }

                else
                {
                    Main__Receptionist_ main = new Main__Receptionist_();
                    this.Hide();
                    main.Show();
                }

            }
            else
            {
                lblStatus.Text = "Login unsuccessful, please try again";
            }


        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}
